//
//  AddressModel.m
//  LoveBeeProject
//
//  Created by 沈腾飞 on 2017/1/9.
//  Copyright © 2017年 斯芬克斯. All rights reserved.
//

#import "AddressModel.h"
#import "NetworkTool.h"

@implementation AddressModel


+(instancetype)addressModelWithDic:(NSDictionary *)dic
{
    AddressModel *model = [[self alloc] init];
    [model setValuesForKeysWithDictionary:dic];
    return model;
}

-(void)setValue:(id)value forUndefinedKey:(NSString *)key
{
    
}


+(void)getAddressModelWithSuccess:(void (^)(NSArray *))successBlock failed:(void (^)(NSError *))failedBlock
{
    NSDictionary *parameters = @{@"call":@"12"};
    [[NetworkTool sharedTool] POSTWith:@"http://iosapi.itcast.cn/loveBeen/MyAdress.json.php" parameters:parameters success:^(id responseObject) {
        
        NSArray *arrData = responseObject[@"data"];
//        NSLog(@"%@",arrData);
        
        
        NSArray *arr = [NSArray yy_modelArrayWithClass:[AddressModel class] json:arrData];
//        NSLog(@"%@",arr);
        
        if (successBlock) {
            successBlock(arr);
        }
        
        
        
    } failed:^(NSError *error) {
        if (failedBlock) {
            failedBlock(error);
        }
    }];
    
    
    
    
}



@end
